//
//  ViewController.m
//  性能优化
//
//  Created by apple on 2022/1/15.
//

#import "ViewController.h"
#import "CronRadiusViewController.h"

static NSString * const CellID = @"DefaultCell";

@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:CellID];
    
    
}

-(NSArray*)dataSource{
    return @[@{
                 @"title":@"圆角性能优化",
                 @"class":@"CronRadiusViewController"
                }

    ];
}


-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return [self dataSource].count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:CellID];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellID];
    }
    cell.textLabel.text = [[self dataSource] objectAtIndex:indexPath.row][@"title"];
    
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
   NSString * VCStr = [[self dataSource] objectAtIndex:indexPath.row][@"class"];
    
    [self.navigationController pushViewController:[NSClassFromString(VCStr) new] animated:YES];    
}




@end
